import Vue from 'vue'
import VueRouter from 'vue-router'
import Recommend from '../views/Recommend.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Recommend',
    component: Recommend,
  },
  {
    path:"/hall",
    name:'Hall',
    component:()=>import('@/views/Hall'),
  },
  {
    path:"/live",
    name:"Live",
    component:()=>import('@/views/Live')
  },
  {
    path: '/video',
    name: 'Video',
    component: () => import('@/views/Video')
  },
  {
    path: '/search',
    name: 'Search',
    component: () => import('@/views/Search')
  },
  {
    path:'/playlist/:listid',
    name:"PlayList",
    meta:{hideNav:true},
    props:true,//把listid注入组件的props
    component:()=>import("@/views/PlayList")
  },
]

const router = new VueRouter({
  mode: 'hash',
  // mode: 'history',
  base: process.env.BASE_URL,
  routes
});
router.beforeResolve((to,from,next)=>{
  // console.log("beforeResolve 全局前置路由守卫 在beforeEach后执行完");
  next()
});
// router.afterEach((to,from)=>{
  // console.log("全局离开路由守卫函数afterEach..",to,from);
// });
export default router

